package com.itheima.mytest;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class Test3 {
    public static void main(String[] args) throws IOException {
        //进行创建对象
        Student s1=new Student("张三",23,"上海");
        Student s2=new Student("李四",24,"北京");
        Student s3=new Student("王五",25,"天津");

        //创建序列化
        ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream("myio\\a.txt"));
        //进行数据的写入
        oos.writeObject(s1);
        oos.writeObject(s2);
        oos.writeObject(s3);

        //关流
        oos.close();
    }
}
